package com.shiguiwu.springmybatis.javabase.thread.lock;

import java.util.concurrent.TimeUnit;

/**
 * @description: redis lock
 * @author: stone
 * @date: Created by 2022/1/15 20:43
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.lock.model
 */
public interface RedisLock {

    /**
     *  redis尝试加锁
     * @param lockKey key
     * @param timeout 超时
     * @param unit 单位
     * @return 是否获取锁
     */
    boolean tryLock(String lockKey, long timeout, TimeUnit unit);


    /**
     * 释放锁
     * @param lockKey key
     */
    void releaseLock(String lockKey);


}
